import Vue from "vue";
import VueRouter from "vue-router";

import allRoutes from "./GenerateRoute"
//配置静态路由
import staticRoutes from "./staticRoutes"
//配置动态路由
// import dynamicRoutes from "./dynamicRoutes"

//把报错改成灰色
// const originalPush = VueRouter.prototype.push
// VueRouter.prototype.push = function push(location) {
//   return originalPush.call(this, location).catch((err) => {
//     console.log(err.toString())
//   })
// }

Vue.use(VueRouter);

const routes = [
  {
    path:"/",
    redirect: "/welcome",
  },
  // {
  //   path:"/",
  //   component:()=>import(/*webpackChunName:'home'*/"@/pages/Home"),
  //   children:[
  //     {
  //       path:"StudentManager/StudentProduct",
  //       component:()=>import(/*webpackChunName:"welcome"*/"@/pages/Home/StudentManager/StudentProduct"),
  //     }
  //   ]
  // },
  //  {
  //   path:"/login",
  //   component:()=>import(/*webpackChunName:'log'*/"@/pages/Login" )
  //  }
  // ...allRoutes,
  ...staticRoutes,
  // dynamicRoutes

];

const router = new VueRouter({
  routes,
});

export default router;
